import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

import com.sun.org.apache.xalan.internal.xsltc.compiler.sym;


public class ReadFromDomain {

public static void main(String[] args)
{
    String filePath = "C:\\test4.txt";
    BufferedReader br;
    String s = "";
    String line = "";
    String read="";
    List<String> tempsPredicate = new LinkedList<String>();
    List<String> tempsType = new LinkedList<String>();

    try {
    	
        br = new BufferedReader(new FileReader(filePath));
        try {
        	
            while((line = br.readLine()) != null)
            {
            	
        		read=br.readLine();

            	String[] words = line.split(" ");
            	

            	 for (String word : words) {

          	 if(word.equals("(:predicates")){
          	
           		 while((read = br.readLine()) != null){
            	  tempsPredicate.add(read);
           		 
               	 }
                	 
         		 
            
           		String[] tempsArray = tempsPredicate.toArray(new String[0]);
        
          	  for(int i=0 ; i<7 ;i++){
              	  String [] predicate=tempsArray[i].split(" ");
                	System.out.println(predicate[0]);

          	  }
          	  
          	
           	 }
          	 
                
            	 }
           
                }
            

            
            br.close();
           
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    

  
    try {
        br = new BufferedReader(new FileReader(filePath));
        try {
            while((line = br.readLine()) != null)
            {

            	
            	String[] words = line.split("//s");

                for (String word : words) {
                  if (word.equals("(:types") ) {
                	  line=br.readLine();
                	  while((read = br.readLine()) != null){
                    	  tempsType.add(line);
                          if (word.equals("(:predicates") );
                        	  break;
                   
                   		 }
                   		String[] tempsArray = tempsType.toArray(new String[0]);
                    	  String [] type=tempsArray[0].split(" ");

                          System.out.println(tempsArray[1]+"*");

                    
                    
                  }
                 


                 
                  
                }

              
            }
         


            
            br.close();
           
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}


}
// substring indexof contain lastindex